package cz.muni.fi.pa036is.dtoconverters;

import cz.muni.fi.pa036is.dto.SeasonBasicTO;
import cz.muni.fi.pa036is.dto.SeasonDetailTO;
import cz.muni.fi.pa036is.dto.SeasonFormTO;
import cz.muni.fi.pa036is.dto.SeasonGridTO;
import cz.muni.fi.pa036is.entity.Season;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Shebik
 */
public class SeasonConverter {

    private SeasonConverter() {
    }

    public static Season convertToSeason(final SeasonFormTO seasonFormTO) {
        final Season season = new Season();
        season.setId(seasonFormTO.getId());
        season.setName(seasonFormTO.getName());
        season.setStartDate(seasonFormTO.getStartDate());
        season.setEndDate(seasonFormTO.getEndDate());
        season.setPointsForDraw(seasonFormTO.getPointsForDraw());
        season.setPointsForLose(seasonFormTO.getPointsForLose());
        season.setPointsForWin(seasonFormTO.getPointsForWin());
        season.setVictoryCondition(seasonFormTO.getVictoryCondition());
        season.setAdmissionPrice(seasonFormTO.getAdmissionPrice());
        return season;
    }

    public static SeasonFormTO convertToSeasonFormTO(final Season season) {
        final SeasonFormTO seasonFormTO = new SeasonFormTO();
        seasonFormTO.setId(season.getId());
        seasonFormTO.setName(season.getName());
        seasonFormTO.setStartDate(season.getStartDate());
        seasonFormTO.setEndDate(season.getEndDate());
        seasonFormTO.setPointsForDraw(season.getPointsForDraw());
        seasonFormTO.setPointsForLose(season.getPointsForLose());
        seasonFormTO.setPointsForWin(season.getPointsForWin());
        seasonFormTO.setVictoryCondition(season.getVictoryCondition());
        seasonFormTO.setAdmissionPrice(season.getAdmissionPrice());
        return seasonFormTO;
    }
				
				public static SeasonBasicTO convertToSeasonBasicTO(final SeasonDetailTO seasonDEtailTO) {
        final SeasonBasicTO seasonBasicTO = new SeasonBasicTO();
        seasonBasicTO.setId(seasonDEtailTO.getId());
        seasonBasicTO.setName(seasonDEtailTO.getName());
        seasonBasicTO.setStartDate(seasonDEtailTO.getStartDate());
        seasonBasicTO.setEndDate(seasonDEtailTO.getEndDate());
        return seasonBasicTO;
    }

    public static SeasonDetailTO convertToSeasonDeatilTO(final Season season) {
        final SeasonDetailTO seasonDetailTO = new SeasonDetailTO();
        seasonDetailTO.setId(season.getId());
        seasonDetailTO.setName(season.getName());
        seasonDetailTO.setStartDate(season.getStartDate());
        seasonDetailTO.setEndDate(season.getEndDate());
        seasonDetailTO.setPointsForDraw(season.getPointsForDraw());
        seasonDetailTO.setPointsForLose(season.getPointsForLose());
        seasonDetailTO.setPointsForWin(season.getPointsForWin());
        seasonDetailTO.setVictoryCondition(season.getVictoryCondition());
        seasonDetailTO.setAdmissionPrice(season.getAdmissionPrice());
        return seasonDetailTO;
    }

    public static SeasonGridTO convertToSeasonGridTO(final Season season) {
        final SeasonGridTO seasonGridTO = new SeasonGridTO();
        seasonGridTO.setId(season.getId());
        seasonGridTO.setName(season.getName());
        seasonGridTO.setStartDate(season.getStartDate());
        seasonGridTO.setEndDate(season.getEndDate());
        return seasonGridTO;
    }

    public static List<SeasonGridTO> convertToSeasonGridTOList(
            final List<Season> seasonList) {
        final List<SeasonGridTO> seasonGridTOList = new ArrayList<SeasonGridTO>();

        for (final Season season : seasonList) {
            seasonGridTOList.add(convertToSeasonGridTO(season));
        }
        return seasonGridTOList;
    }

    public static List<SeasonBasicTO> convertToSeasonBasicTOList(
            final List<Season> seasonList) {
        final List<SeasonBasicTO> seasonBasicTOList = new ArrayList<SeasonBasicTO>();

        for (final Season season : seasonList) {
            seasonBasicTOList.add(convertToSeasonBasicTO(season));
        }
        return seasonBasicTOList;
    }

    public static SeasonBasicTO convertToSeasonBasicTO(final Season season) {
        final SeasonBasicTO seasonBasicTO = new SeasonBasicTO();
        seasonBasicTO.setId(season.getId());
        seasonBasicTO.setName(season.getName());
        seasonBasicTO.setStartDate(season.getStartDate());
        seasonBasicTO.setEndDate(season.getEndDate());
        return seasonBasicTO;
    }
}
